/**
 * 格式化 querystring
 * taskId=3&scene=1011 ->
 * {taskId:3,scene:1011}
 */
export const formatQuery = str => {
  if (!str) return;
  const result = {};
  if (str.includes('&')) {
    const arr = str.split('&');
    arr.forEach(item => {
      const arr1 = item.split('=');
      result[arr1[0]] = arr1[1];
    });
  } else {
    const arr = str.split('=');
    result[arr[0]] = arr[1];
  }
  return result;
};
